package com.zzyl.framework;

import com.aliyun.iot20180120.Client;
import com.aliyun.teaopenapi.models.Config;
import com.zzyl.framework.config.properties.AliIoTConfigProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class IotClientConfig {


    @Autowired
    private AliIoTConfigProperties aliIoTConfigProperties;


    @Bean
    public Client client() throws Exception {
        Config config = new Config()
                .setAccessKeyId(aliIoTConfigProperties.getAccessKeyId())
                .setAccessKeySecret(aliIoTConfigProperties.getAccessKeySecret())
                .setRegionId(aliIoTConfigProperties.getRegionId());
        return new Client(config);
    }


}
